<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
    
  <script>

    var students = [
      {id:100, name:"aa",age:18},
      {id:101, name:"bb",age:12},
      {id:102, name:"cc",age:54},
      {id:103, name:"dd",age:43},
      {id:104, name:"ee",age:23}
    ]

    Array.prototype.yeFind = function (fn) {

      var res = undefined
      for (var i = 0; i < this.length; i++) {
        var flag = false
        flag = fn(this[i], i, this)
        if (flag) {
          res = this[i]
          break
        }
      }
      return res
      
    }

    students.yeFind(function(a, b, c) {
      console.log(a);
      console.log(b);
      console.log(c);
    })


    // students.find(function(a,b,c) {
    //   console.log(a);
    //   console.log(b);
    //   console.log(c);
    // })
    Math.random()
    

    function foo() {
      
    }
    var f = foo
    f.msg = "123"
    console.log(typeof f);

    var arr = [1, 2, 3]
    var arrstr = arr.join("-")
    console.log(arrstr);

    var str = "1231"
    var newStr = str.replace(/1$/,"a")
    console.log(newStr)
    
    console.log(new Number()) 
    var num1 = 123
    console.log(Number.parseFloat(num1));
    console.log(parseFloat(num1));

    console.log(window.parseFloat == Number.parseFloat)

    var fn1 = function() {}
    var obj1 = {}
    var fn2 = new Function()
    console.log(typeof fn1)
    console.log(typeof obj1);
    console.log(typeof fn2);
    console.log(fn2 == fn1);

    // console.log(window);

    // console.log(this);
    
    var msg = "hell world"
    var obj = {
      name: "aaa",
      age: 18,
      [msg]: "你好 世界",
      getAge: function() {
        return this.age
      }
    }

    function createStudent(name, age, height) {
      var stu = {}
      stu.name = name
      stu.age = age
      stu.height = height
      stu.running = function() {
        console.log("running");
      }
      return stu
    }

    var objAge = obj.getAge()
    console.log(objAge)

    console.log(obj[msg]);

    for (var key in obj) {
      // debugger
      console.log(key);
    }
  </script>
</body>
</html>